package com.LostAndFound.service;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

import com.LostAndFound.dao.SearchForLoseDao;
import com.LostAndFound.domain.Article;

public class SearchForLoseService {

	SearchForLoseDao dao = new SearchForLoseDao();
	// 
	public int getTotalRecordForEasyUI(String cid) {
		int total = 0;
		try {
			total = dao.getTotalRecordForEasyUI(cid);
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return total;
	}
	// 要进行审核的记录数
	public int getTotalCheckRecordForEasyUI(String cid) {
		int total = 0;
		try {
			total = dao.getTotalCheckRecordForEasyUI(cid);
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return total;
	}

	public List<Map<String, Object>> getRecodListForEasyUI(int pageNumber, int pageSize, String cid) {
		List<Map<String, Object>> mapList = null;
		int startIndex = (pageNumber-1)*pageSize;
		
		try {
			mapList = dao.getRecodListForEasyUI(startIndex,pageSize,cid);
		} catch (SQLException e) {
			e.printStackTrace();
		}
		
		return mapList;
	}
	// 得到要审核的全部记录
	public List<Map<String, Object>> getCheckRecodListForEasyUI(int pageNumber, int pageSize, String cid) {
		List<Map<String, Object>> mapList = null;
		int startIndex = (pageNumber-1)*pageSize;
		
		try {
			mapList = dao.getCheckRecodListForEasyUI(startIndex,pageSize,cid);
		} catch (SQLException e) {
			e.printStackTrace();
		}
		
		return mapList;
	}
	public boolean handleDeleteSearchLoseRecordForEasyUI(String aid) {
		boolean success = false;
		try {
			dao.handleDeleteSearchLoseRecordForEasyUI(aid);
			success = true;
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return success;
	}

	/*
	 * 隐藏此功能，2019/03/03
	 */
	public boolean handleAddNewSearchLose(Article article) {
		boolean success = false;
		try {
			dao.handleAddNewSearchLose(article);
			success = true;
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return success;
	}

}
